package com.cldz.controller;

import com.cldz.common.dto.req.FsuControlDto;
import com.cldz.common.dto.res.FsuControlResDto;
import com.cldz.feign.FsuControlFeign;
import com.cldz.response.support.ServerResponse;
import com.cldz.service.FsuControlService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ Author     ：lixiao.
 * @ Date       ：Created in 15:24 2018/12/24
 * @ Description：
 * @ Modified By：
 */
@Slf4j
@RestController
public class FsuControlController implements FsuControlFeign {

    @Autowired
    private FsuControlService fsuControlService;

    /**
     * 读取指定设备控制记录(FSU)
     * @param fsuControlDto
     * @return
     */
    @GetMapping("/fsuDevControlRecord")
    public ServerResponse getFsuDevControlRecord(FsuControlDto fsuControlDto){
        List<FsuControlResDto> list = fsuControlService.getFsuDevControlRecord(fsuControlDto);
        Integer amount = fsuControlService.getFsuDevControlRecordAmount(fsuControlDto);
        return ServerResponse.createDataAndCount(amount,list);
    }

    /**
     * 读取全部设备控制记录(FSU)
     * @param fsuControlDto
     * @return
     */
    @GetMapping("/fsuAllControlRecord")
    public ServerResponse getFsuAllControlRecord(FsuControlDto fsuControlDto){
        List<FsuControlResDto> list = fsuControlService.getFsuAllControlRecord(fsuControlDto);
        Integer amount = fsuControlService.getFsuAllControlRecordAmount(fsuControlDto);
        return ServerResponse.createDataAndCount(amount,list);
    }
}
